﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace RestServer.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class AccountController : ControllerBase
    {
        [HttpGet]
        public ResEntity Get()
        {
            //var rng = new Random();
            //return Enumerable.Range(1, 5).Select(index => new WeatherForecast
            //{
            //    Date = DateTime.Now.AddDays(index),
            //    TemperatureC = rng.Next(-20, 55),
            //    Summary = Summaries[rng.Next(Summaries.Length)]
            //})
            //.ToArray();
            Data data = new Data();
            data.total = 2;
            data.list = new List<DetailEntity> {
            new DetailEntity{id=1,fileName="f1"},new DetailEntity{id=2,fileName="f2"}
            };

            return new ResEntity { code=200,message="OK1",data=data};
        }
    }

    public class ResEntity
    {
        public int code { get; set; } = 200;
        public string message { get; set; } = "OK";
        public Data data { get; set; }
    }

    public class Data
    {
        public int total { get; set; } = 0;
        public List<DetailEntity> list { get; set; }
    }

    public class DetailEntity
    {
        public int id { get; set; }
        public string fileName { get; set; }
          
        //"id": 13,
        //        "fileName": "aa.txt",
        //        "size": 9084,
        //        "status": 5,
        //        "uploadTime": "2020-12-18 11:26:08"
    }
}
